package com.nbsaas.boot.order.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.time.LocalDateTime;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "订单评价", model = "订单评价")
@Entity
@Table(name = "bs_order_review")
@Comment("订单评价表")
public class OrderReview extends AbstractEntity {

    @Comment("订单ID")
    @FormField(title = "订单ID", sortNum = "1", grid = true, required = true)
    @Column(name = "order_id", nullable = false)
    private Long orderId;

    @Comment("订单编号")
    @FormField(title = "订单编号", sortNum = "2", grid = true, required = true)
    @Column(name = "order_no", nullable = false, length = 64)
    private String orderNo;

    @Comment("订单商品ID")
    @FormField(title = "订单商品ID", sortNum = "3", grid = true, required = true)
    @Column(name = "order_item_id", nullable = false)
    private Long orderItemId;

    @Comment("商品ID")
    @FormField(title = "商品ID", sortNum = "4", grid = true, required = true)
    @Column(name = "product_id", nullable = false)
    private Long productId;

    @Comment("商品SKU ID")
    @FormField(title = "商品SKU ID", sortNum = "5", grid = true, required = true)
    @Column(name = "product_sku_id", nullable = false)
    private Long productSkuId;

    @Comment("用户ID")
    @FormField(title = "用户ID", sortNum = "6", grid = true, required = true)
    @Column(name = "user_id", nullable = false)
    private Long userId;

    @Comment("用户昵称")
    @FormField(title = "用户昵称", sortNum = "7", grid = true)
    @Column(name = "user_nickname", length = 50)
    private String userNickname;

    @Comment("用户头像")
    @FormField(title = "用户头像", sortNum = "8", type = InputType.image)
    @Column(name = "user_avatar", length = 200)
    private String userAvatar;

    @Comment("评分")
    @FormField(title = "评分", sortNum = "9", grid = true, type = InputType.select)
    @Column(name = "rating", nullable = false)
    private Integer rating = 5;

    @Comment("评价内容")
    @FormField(title = "评价内容", sortNum = "10", type = InputType.textarea)
    @Column(name = "content", length = 1000)
    private String content;

    @Comment("评价图片")
    @FormField(title = "评价图片", sortNum = "11", type = InputType.image)
    @Column(name = "images", length = 1000)
    private String images;

    @Comment("评价标签")
    @FormField(title = "评价标签", sortNum = "12", grid = true)
    @Column(name = "tags", length = 200)
    private String tags;

    @Comment("是否匿名")
    @FormField(title = "是否匿名", sortNum = "13", grid = true, type = InputType.select)
    @Column(name = "is_anonymous", nullable = false)
    private Boolean isAnonymous = false;

    @Comment("评价状态")
    @FormField(title = "评价状态", sortNum = "14", grid = true, type = InputType.select)
    @Column(name = "review_status", nullable = false)
    private Integer reviewStatus = 0;

    @Comment("评价时间")
    @FormField(title = "评价时间", sortNum = "15", type = InputType.date, grid = true, required = true)
    @Column(name = "review_time", nullable = false)
    private LocalDateTime reviewTime;

    @Comment("审核时间")
    @FormField(title = "审核时间", sortNum = "16", type = InputType.date, grid = true)
    @Column(name = "audit_time")
    private LocalDateTime auditTime;

    @Comment("审核人ID")
    @FormField(title = "审核人ID", sortNum = "17", grid = true)
    @Column(name = "auditor_id")
    private Long auditorId;

    @Comment("审核备注")
    @FormField(title = "审核备注", sortNum = "18", type = InputType.textarea)
    @Column(name = "audit_remark", length = 200)
    private String auditRemark;

    @Comment("点赞数")
    @FormField(title = "点赞数", sortNum = "19", grid = true, type = InputType.el_input_number)
    @Column(name = "like_count", nullable = false)
    private Integer likeCount = 0;

    @Comment("回复内容")
    @FormField(title = "回复内容", sortNum = "20", type = InputType.textarea)
    @Column(name = "reply_content", length = 500)
    private String replyContent;

    @Comment("回复时间")
    @FormField(title = "回复时间", sortNum = "21", type = InputType.date, grid = true)
    @Column(name = "reply_time")
    private LocalDateTime replyTime;

    @Comment("回复人ID")
    @FormField(title = "回复人ID", sortNum = "22", grid = true)
    @Column(name = "reply_user_id")
    private Long replyUserId;

    @Comment("回复人姓名")
    @FormField(title = "回复人姓名", sortNum = "23", grid = true)
    @Column(name = "reply_user_name", length = 50)
    private String replyUserName;
} 